using System;
using System.Collections.Generic;
using System.Text;
using Lidgren.Library.Network;
using System.Net;

namespace SharpWind.Network
{
	public delegate void ConnectionEventHandler( object sender, ConnectionEventArgs e );

	public class ConnectionEventArgs : EventArgs
	{
		private Connection connection = null;

		private string reason = string.Empty;

		public ConnectionEventArgs( Connection connection ) : this( string.Empty, connection )
		{
		
		}

		public ConnectionEventArgs( string reason, Connection connection )
		{
			this.reason = reason;
			this.connection = connection;
		}

		public Connection Connection
		{
			get
			{
				return this.connection;
			}
		}

		public string Reason
		{
			get
			{
				return this.reason;
			}
		}
	}


	public delegate void StatusEventHandler( object sender, StatusEventArgs e );

	public class StatusEventArgs : EventArgs
	{
		private string reason = string.Empty;

		public StatusEventArgs( string reason )
		{
			this.reason = reason;
		}

		public string Reason
		{
			get
			{
				return this.reason;
			}
		}
	}


	public delegate void NetworkLogEventHandler( object sender, NetworkLogEventArgs e );

	public class NetworkLogEventArgs : EventArgs
	{
		private NetLogEntry entry = null;

		public NetworkLogEventArgs( NetLogEntry entry )
		{
			this.entry = entry;
		}

		public NetLogEntry Entry
		{
			get
			{
				return this.entry;
			}
		}
	}


	public delegate void ServerDiscoveredEventHandler( object sender, ServerDiscoveredEventArgs e );

	public class ServerDiscoveredEventArgs : EventArgs
	{
		private int maxConnections = 0;

		private int numConnected = 0;

		private IPEndPoint endPoint = null;

		private string serverName = null;

		public ServerDiscoveredEventArgs( int maxConnections, int numConnected, IPEndPoint endPoint, string serverName )
		{
			this.maxConnections = maxConnections;
			this.numConnected = numConnected;
			this.endPoint = endPoint;
			this.serverName = serverName;
		}

		public int MaxConnections
		{
			get
			{
				return this.maxConnections;
			}
		}

		public int NumConnected
		{
			get
			{
				return this.numConnected;
			}
		}

		public IPEndPoint EndPoint
		{
			get
			{
				return this.endPoint;
			}
		}

		public string ServerName
		{
			get
			{
				return this.serverName;
			}
		}
	}


	public delegate void VoiceEventHandler( object sender, VoiceEventArgs e );

	public class VoiceEventArgs : EventArgs
	{
		private byte[] buffer = null;

		public VoiceEventArgs( byte[] buffer )
		{
			this.buffer = buffer;
		}

		public byte[] Buffer
		{
			get
			{
				return this.buffer;
			}
		}
	}
}
